package com.xuanyue.db.xuan.core.db;

import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;

import com.xuanyue.db.xuan.core.table.IXyTable;
/**
 * 库接口
 * @author 解观海
 * @email  guanhaixie@sina.cn
 * @date 2020年6月23日
 *
 */
public interface IXyDB {

	public void init(DBMetaV2 dbMeta) throws Exception;
	public void load()throws Exception;
	public IXyTable getTable(String name);
	public String getDataPath();
	public IXyTable createTable(TableMetaV2 tableMetaV2);
	
	public void setSource(String name,int source);
	public void dropColumn(String name,String cname);
	public void addColumn(String name,ColumnMetaV2 cmV2);
	/**
	 * 
	 * @param tableName 表名
	 * @param con  column old name  原始列名称
	 * @param cmV2
	 * @author 解观海
	 * @date 2021年1月8日
	 */
	public boolean alertColumn(String tableName,String con,ColumnMetaV2 cmV2);
	
	public DBMetaV2 getDBMetaV2();
	
	public ReadLock getReadLockOfMeta();
	public WriteLock getWriteLockOfMeta();
}
